import request from '@/utils/request'

export function login(data) {
  return request({
    // url: '/vue-element-admin/user/login',
    url: '/user/login',
    method: 'post',
    params: data
  })
}

export function getInfo(token) {
  return request({
    url: '/user/info',
    // url: '/vue-element-admin/user',
    method: 'get'
    // params: { token }
  })
}

export function logout() {
  return request({
    url: '/user/logout',
    method: 'post'
  })
}
export function getAllUserInfo() {
  return request({
    url: '/user/getAllUserInfo',
    method: 'get'
  })
}
export function delUser(id) {
  return request({
    url: `/user/delUser/${id}`,
    method: 'delete'
  })
}
export function findByUserName(username) {
  return request({
    url: `/user/findByUserName`,
    method: 'get',
    params: { username }
  })
}
export function insertOrUpdateUser(data) {
  return request({
    url: '/user/insertOrUpdate',
    method: 'post',
    params: data
  })
}
export function findByAdminUserId(id) {
  return request({
    url: `/user/findByAdminUserId/${id}`,
    method: 'get'
  })
}
